//
//  QNService.h
//  QNReuseTool
//
//  Created by rsh on 2019/10/15.
//  Copyright © 2019年 rsh. All rights reserved.
//

#import <UIKit/UIKit.h>

@class QNService, UNNotification, UNNotificationResponse;

@protocol QNServiceProtocol <NSObject>

@required
- (void)service:(QNService *)service launchWithOptions:(NSDictionary *)options;

@optional
- (BOOL)service:(QNService *)service openURL:(NSURL *)url;
- (void)service:(QNService *)service didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken;
- (void)service:(QNService *)service didFailToRegisterForRemoteNotificationsWithError:(NSError *)error;
- (void)service:(QNService *)service didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler;
- (void)service:(QNService *)service didReceiveRemoteWithPresentNotification:(UNNotification *)notification;
- (void)service:(QNService *)service didReceiveRemoteWithPresentNotificationResponse:(UNNotificationResponse *)response;
- (void)service:(QNService *)service jpushAlias:(NSString *)jpushAlias;
- (void)deleteJPUSHAlias:(QNService *)service;

- (void)resetBadge:(QNService *)service;

@end

@interface QNService : NSObject <QNServiceProtocol>

// 启动应用回调
+ (void)serviceLauchWithServices:(NSArray <QNService *> *)services options:(NSDictionary *)options;
// 推送Token注册
+ (void)serviceDidRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken;
// 推送注册失败回调
+ (void)serviceDidFailToRegisterForRemoteNotificationsWithError:(NSError *)error;
// 收到远程推送回调 iOS7
+ (void)serviceReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler;
// 收到远程推送回调 iOS10
+ (void)serviceReceiveRemoteWithPresentNotification:(UNNotification *)notification __IOS_AVAILABLE(10.0);
// 点击远程推送回调 iOS10
+ (void)serviceReceiveRemoteWithPresentNotificationResponse:(UNNotificationResponse *)response __IOS_AVAILABLE(10.0);
// 第三方调起应用回调
+ (BOOL)serviceHandleOpenURL:(NSURL *)url;
// 设置推送的别名
+ (void)setJPUSHAlias:(NSString *)jpushAlias;
// 删除当前设备推送的所有别名
+ (void)deleteJPUSHAlias;

+ (void)resetBadge;

@end
